package thread;

public class PriorityDemo {
    public static void main(String[] args) {
        Thread min = new Thread() {
            public void run() {
                for (int i = 0; i < 10000; i++) {
                    System.out.println("min");
                }

            }
        };


        Thread max = new Thread() {
            public void run() {
                for (int i = 0; i < 10000; i++) {
                    System.out.println("max");
                }

            }
        };
        Thread mid = new Thread() {
            public void run() {
                for (int i = 0; i < 10000; i++) {
                    System.out.println("mid");
                }

            }
        };
        min.setPriority(Thread.MIN_PRIORITY);//设置优先级,最低优先级为1
        max.setPriority(Thread.MAX_PRIORITY);//最高优先级为10
        min.start();//默认优先级为5
        mid.start();
        max.start();
    }
}
